package com.xsomnus.open.im.demo.io;

import java.net.Socket;
import java.util.Date;

/**
 * @author @xsomnus666_xiawenye★
 * @since 2019/4/24 0024 11:26
 * 当你发现自己的才华撑不起野心时，就请安静下来学习吧
 */
public class IOClient {


    public static void main(String[] args) {
        new Thread(() -> {
            try {
                Socket socket = new Socket("127.0.0.1", 8000);
                while (true) {
                    socket.getOutputStream().write((new Date() + ": hello, world").getBytes());
                    Thread.sleep(2_000);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();
    }

}
